<?php

namespace App\Transformers;

use Illuminate\Database\Eloquent\Model;
use League\Fractal\TransformerAbstract;

class MatchOrderTransformer extends TransformerAbstract
{
    public function transform(Model $tx)
    {
        return [
            'id'=>$tx->id,
            'deposit_trade_queue_id'=>$tx->deposit_trade_queue_id,  // 入金单
            'withdraw_trade_queue_id'=>$tx->withdraw_trade_queue_id,  // 出金单 id
            'deposit_trade_queue_user'=>$tx->depositQueue->user,
            'withdraw_trade_queue_user'=>$tx->withdrawQueue->user,
            'amount'=>$tx->amount,         // 撮合的金额
            'deposit_proof_img_url'=>$tx->deposit_proof_img_url ,    // 入金凭证图片地址
            "deposit_confirm_at" => $tx->deposit_confirm_at,  // 确认时间
            "withdraw_confirm_at" => $tx->withdraw_confirm_at,  // 确认时间
            "deposit_arbitration_at" => $tx->deposit_arbitration_at, // 发起人申诉时间
            "withdraw_arbitration_at" => $tx->withdraw_arbitration_at, // 提现人申诉时间
            "is_cancle" => $tx->is_cancle, // 是否被取消
            "is_manual" => $tx->is_manual, // 是否手动
            "created_at" => $tx->updated_at->timestamp, // 匹配成功的时间
        ];
    }
}
